function connect(dbName) {
    //引入mongoose模块
    let mongoose = require('mongoose');
    //建立数据库连接
    let dbUri = "mongodb://localhost:27017/"+dbName;
    mongoose.connect(dbUri, {
        useNewUrlParser: true,
        useUnifiedTopology: true
    });
    //数据库连接成功要执行的回调函数指定
    mongoose.connection.on('connected', function () {
        console.log('mongodb数据库连接成功!');
    });
}

module.exports=connect;
